package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.domain.CommonResult;
import com.atguigu.springcloud.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 赵赳
 * @CreateTime: 2021/3/7 13:15
 * @Description:
 */
@RestController
public class StorageController {

    @Autowired
    private StorageService storageService;

    /**
     *  库存减少
     * @param productId 订单编号
     * @param count 账户
     * @return
     */
    @PostMapping(value = "/storage/decrease")
    CommonResult decrease(@RequestParam("productId") Long productId,
                          @RequestParam("count") Integer count){
        storageService.decrease(productId,count);
        return new CommonResult(200,"库存扣除成功");
    }


}
